<?php

function smarty_function_get_shop_by_id($params, &$smarty) {
    //Get value from page
    $shop_id = $params['shop_id'];
    if($shop_id){
      //Query data

      //Check exist user & topic
      $pntables = pnDBGetTables();
      $table  = $pntables['icarrent_shop'];
      $column = $pntables['icarrent_shop_column'];

      $sql = "SELECT
                $table.$column[name]  
              FROM
                $table 
              WHERE
                $table.$column[id] = ".$shop_id;

      $column = array("shop_name");
      $result = DBUtil::executeSQL($sql);
      $objectArray = DBUtil::marshallObjects ($result, $column);
      $shop_name = $objectArray['0']['shop_name'];
    }
    if ($shop_name) {
        return $shop_name; 
    } else {
        return "";
    }
}